//
//  SEGOrderInputHttpManager.m
//  Uhomebk
//
//  Created by mac on 2017/7/4.
//  Copyright © 2017年 com.segi. All rights reserved.
//

#import "SEGOrderInputHttpManager.h"
#import "SEGWorkOrderUrlList.h"

@implementation SEGOrderInputHttpManager

+ (instancetype)sharedManager{
    static SEGOrderInputHttpManager *instance;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        instance = [[self alloc] init];
    });
    
    return instance;
}

#pragma mark - 数据请求方法
/**
 拉取日常工单录入菜单数据
 
 @param params 参数
 @param type 工单录入界面来源
 @param finished 回调
 */
-(void)getOrderInputListDataWith:(NSDictionary *)params type:(SEGOrderInputEnterType)type finished:(SEGNetworkReponse)finished
{
    [SEGHTTPBusinessManager seg_requestJSONWithMethod:POST URLString:API_NEW_ORDER_INPUT_LIST parameters:params finished:^(BOOL isSuccessed, id result, NSString *codeType, NSString *errorMessage) {
        finished(isSuccessed, result, codeType, errorMessage);
    }];
}


/**
 拉取工单录入详情表单数据

 @param params 参数
 @param type 工单录入界面来源
 @param finished 回调
 */
-(void)getOrderInputDetailDataWith:(NSDictionary *)params type:(SEGOrderInputEnterType)type  finished:(SEGNetworkReponse)finished
{
    [SEGHTTPBusinessManager seg_requestJSONWithMethod:POST
                                            URLString:API_NEW_ORDER_INPUT_DETAIL
                                           parameters:params
                                             finished:^(BOOL isSuccessed,
                                                        id result,
                                                        NSString *codeType,
                                                        NSString *errorMessage) {
                                                 finished(isSuccessed, result, codeType, errorMessage);
                                             }];
}


/**
 提交普通工单录入详情表单数据

 @param params 参数
 @param finished 回调
 */
-(void)submitCommonOrderInputDetailDataWith:(NSDictionary *)params finished:(SEGNetworkReponse)finished
{
    [SEGHTTPBusinessManager seg_requestJSONWithMethod:POST
                                            URLString:API_NEW_ORDER_SUBMIT_ORDER_FORM
                                           parameters:params
                                             finished:^(BOOL isSuccessed,
                                                        id result,
                                                        NSString *codeType,
                                                        NSString *errorMessage) {
                                                 finished(isSuccessed, result, codeType, errorMessage);
                                             }];
}


/**
 拉取字典表信息
 
 @param params 参数
 @param finished 回调
 */
-(void)getDictListWith:(NSDictionary *)params finished:(SEGNetworkReponse)finished
{
    
    [SEGHTTPBusinessManager seg_requestWithMethod:GET URLString:API_NEW_ORDER_BESPEAK_TIME parameters:@{@"organId":kAccountCommunityID} finished:^(BOOL isSuccessed, id result, NSString *codeType, NSString *errorMessage) {
        finished(isSuccessed, result, codeType, errorMessage);
    }];
}

/**
 拉取我提交过的工单
 @param params 参数
 @param finished 回调
 */
-(void)getMyOrderListDataWith:(NSDictionary *)params  finished:(SEGNetworkReponse)finished
{
    [SEGHTTPBusinessManager seg_requestJSONWithMethod:POST
                                            URLString:kSEGOrderHisSubmitOrder
                                           parameters:params
                                             finished:^(BOOL isSuccessed,
                                                        id result,
                                                        NSString *codeType,
                                                        NSString *errorMessage) {
                                                 finished(isSuccessed, result, codeType, errorMessage);
                                             }];
}
@end
